import 'package:get/get_navigation/src/routes/route_middleware.dart';
import 'package:flutter/cupertino.dart';
import 'package:library_base/route/routers.dart';
import 'package:library_base/utils/sp_util.dart';

class LoginMiddleware extends GetMiddleware {
  @override
  int? priority = 100;

  @override
  RouteSettings? redirect(String? route) {
    if (SPUtil.token.isNotEmpty) {
      return super.redirect(route);
    } else {
      return const RouteSettings(name: Routers.login);
    }
  }
}
